package com.ninemax.service;

import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer;
import org.apache.solr.core.CoreContainer;

public class LocalSolr {
	// 注意，下面的属性也是可以在jvm参数里面设置的
		static {
			System.setProperty("solr.solr.home", "F:/tomcat-7.0.55-solr4.9-8080-m/solr/");
		}

		public CoreContainer getCoreContainer() {

			CoreContainer coreContainer = new CoreContainer();
			return coreContainer;
		}

		public SolrServer getSolrServer(String coreName ) {
			return new EmbeddedSolrServer(getCoreContainer(), null==coreName?coreName:"core1");
		}

}
